const express = require('express');
const columnController = require('./../controllers/columnController');
const authController = require('./../controllers/authController');
const router = express.Router({ mergeParams: true });
// '/users/:userId(234fad4)/ columns/94887fda',
// P0ST /users/234fad4/ columns
// GET /users/234fad4/ columns
//GET /users/234fad4/ columns/94887fda
router.use(authController.protect);
router
  .route('/getMyColumn')
  .get(columnController.setColumnUserId, columnController.findUserColumn);
router.route('/').get(columnController.getAllColumns).post(
  columnController.setColumnUserId,
  // authController.restrictTo('user'),
  columnController.createColumn
);
router
  .route('/:id')
  .get(columnController.getColumn)
  .delete(columnController.deleteColumn);
module.exports = router;
